home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / miscellaneous / science / maths / calc / source / symbol.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-07  |  2.0 KB  |  78 lines

  1. /*
  2.  * Copyright (c) 1993 David I. Bell
  3.  * Permission is granted to use, distribute, or modify this source,
  4.  * provided that this copyright notice remains intact.
  5.  */
  6.  
  7. #ifndef    SYMBOL_H
  8. #define    SYMBOL_H
  9.  
  10. #include "zmath.h"
  11.  
  12.  
  13. /*
  14.  * Symbol Declarations.
  15.  */
  16. #define SYM_UNDEFINED    0    /* undefined symbol */
  17. #define SYM_PARAM    1    /* parameter symbol */
  18. #define SYM_LOCAL    2    /* local symbol */
  19. #define SYM_GLOBAL    3    /* global symbol */
  20. #define    SYM_STATIC    4    /* static symbol */
  21.  
  22. #define    SCOPE_GLOBAL    0    /* file scope level for global variables */
  23. #define    SCOPE_STATIC    1    /* lowest file scope for static variables */
  24.  
  25.  
  26. typedef struct global GLOBAL;
  27. struct global {
  28.     int g_len;        /* length of symbol name */
  29.     short g_filescope;    /* file scope level of symbol (0 if global) */
  30.     short g_funcscope;    /* function scope level of symbol */
  31.     char *g_name;        /* global symbol name */
  32.     VALUE g_value;        /* global symbol value */
  33.     GLOBAL *g_next;        /* next symbol in hash chain */
  34. };
  35.  
  36.  
  37. /*
  38.  * Routines to search for global symbols.
  39.  */
  40. extern GLOBAL *addglobal MATH_PROTO((char *name, BOOL isstatic));
  41. extern GLOBAL *findglobal MATH_PROTO((char *name));
  42.  
  43.  
  44. /*
  45.  * Routines to return names of variables.
  46.  */
  47. extern char *localname MATH_PROTO((long n));
  48. extern char *paramname MATH_PROTO((long n));
  49. extern char *globalname MATH_PROTO((GLOBAL *sp));
  50.  
  51.  
  52. /*
  53.  * Routines to handle entering and leaving of scope levels.
  54.  */
  55. extern void resetscopes MATH_PROTO((void));
  56. extern void enterfilescope MATH_PROTO((void));
  57. extern void exitfilescope MATH_PROTO((void));
  58. extern void enterfuncscope MATH_PROTO((void));
  59. extern void exitfuncscope MATH_PROTO((void));
  60.  
  61.  
  62. /*
  63.  * Other routines.
  64.  */
  65. extern long addlocal MATH_PROTO((char *name));
  66. extern long findlocal MATH_PROTO((char *name));
  67. extern long addparam MATH_PROTO((char *name));
  68. extern long findparam MATH_PROTO((char *name));
  69. extern void initlocals MATH_PROTO((void));
  70. extern void initglobals MATH_PROTO((void));
  71. extern int writeglobals MATH_PROTO((char *name));
  72. extern int symboltype MATH_PROTO((char *name));
  73. extern void showglobals MATH_PROTO((void));
  74.  
  75. #endif
  76.  
  77. /* END CODE */
  78.